import React, { useEffect } from
 'react'
import { connect, useDispatch } from 'react-redux'
import { addList, deleteList } from '../../store/tabReducer/tabReducer'
import { useSelector } from '../../store/hooks'
const Index = () => {
	const dispatch = useDispatch();
	const username = useSelector(state => state.tabReducer.username)
	const list = useSelector(state => state.tabReducer.list)


	return (
		<div>
			<h1>{username}</h1>
			<input type="text" placeholder='请添加数据' />
			<button onClick={() => dispatch(addList(1))}>添加</button>
			<ul>
				{list.map((v, i) => {
					return <li key={i}>
						<b>{v}</b>
						<button onClick={() => dispatch(deleteList(i))}>删除</button>
					</li>
				})}
			</ul>
		</div>
	)
}


export default Index